/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.crossriver.crgis.database.service.http;

import com.crossriver.crgis.database.model.Application_C_of_O;

import com.liferay.portal.kernel.json.JSONArray;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.util.StringPool;

import java.util.Date;
import java.util.List;

/**
 * @author    Wole Adetiba
 * @generated
 */
public class Application_C_of_OJSONSerializer {
	public static JSONObject toJSONObject(Application_C_of_O model) {
		JSONObject jsonObj = JSONFactoryUtil.createJSONObject();

		jsonObj.put("applicationId", model.getApplicationId());
		jsonObj.put("userId", model.getUserId());

		Date applicationStartDate = model.getApplicationStartDate();

		String applicationStartDateJSON = StringPool.BLANK;

		if (applicationStartDate != null) {
			applicationStartDateJSON = String.valueOf(applicationStartDate.getTime());
		}

		jsonObj.put("applicationStartDate", applicationStartDateJSON);

		Date dateOfApplication = model.getDateOfApplication();

		String dateOfApplicationJSON = StringPool.BLANK;

		if (dateOfApplication != null) {
			dateOfApplicationJSON = String.valueOf(dateOfApplication.getTime());
		}

		jsonObj.put("dateOfApplication", dateOfApplicationJSON);
		jsonObj.put("fileNo", model.getFileNo());
		jsonObj.put("oldCofONo", model.getOldCofONo());
		jsonObj.put("application", model.getApplication());
		jsonObj.put("applicationType", model.getApplicationType());

		Date dateOfIssuance = model.getDateOfIssuance();

		String dateOfIssuanceJSON = StringPool.BLANK;

		if (dateOfIssuance != null) {
			dateOfIssuanceJSON = String.valueOf(dateOfIssuance.getTime());
		}

		jsonObj.put("dateOfIssuance", dateOfIssuanceJSON);
		jsonObj.put("previousCofONumber", model.getPreviousCofONumber());
		jsonObj.put("landUseType", model.getLandUseType());
		jsonObj.put("landUsePurpose", model.getLandUsePurpose());
		jsonObj.put("attestation", model.getAttestation());
		jsonObj.put("status", model.getStatus());
		jsonObj.put("referenceNo", model.getReferenceNo());

		return jsonObj;
	}

	public static JSONArray toJSONArray(
		com.crossriver.crgis.database.model.Application_C_of_O[] models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Application_C_of_O model : models) {
			jsonArray.put(toJSONObject(model));
		}

		return jsonArray;
	}

	public static JSONArray toJSONArray(
		com.crossriver.crgis.database.model.Application_C_of_O[][] models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Application_C_of_O[] model : models) {
			jsonArray.put(toJSONArray(model));
		}

		return jsonArray;
	}

	public static JSONArray toJSONArray(
		List<com.crossriver.crgis.database.model.Application_C_of_O> models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Application_C_of_O model : models) {
			jsonArray.put(toJSONObject(model));
		}

		return jsonArray;
	}
}